#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>
int removeDuplicates(int* nums, int numsSize)
{
    int* str = nums + 1;
    int* begin = nums;
    int k = 0;
    int j = 1;
    int w = 0;

    while (j < numsSize)
    {
        if (*str == *begin)
        {
            str++;
            j++;
            k++;
        }
        else
        {
            while (k > 0)
            {
                *(begin + k) = *str;
                k--;
            }

            j++;
            if(j < numsSize)
            {
                w++;
                str++;
                begin++;
            }
        }

    }
    
    return w+2;
}

int main()
{
    int nums[] = { 0,0,1,1,1,2,2,3,3,4 };
    int numsSize = 10;
    int ret=removeDuplicates(nums, numsSize);

    printf("%d", ret);
	return 0;
}